<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>可根据浏览器窗口大小等比例缩放 适合移动端开发</title>
    <style>
        section {
            display: flex;
            width: 60%;
            height: 150px;
            background-color: pink;
            margin: 0 auto;
        }
        section div:nth-child(1) {
            width: 100px;
            height: 150px;
            background-color: skyblue;
        }
        section div:nth-child(2) {
            /*  自动分配父级所有剩余空间 去掉1号和3号盒子宽度后 */
            flex: 1;
            background-color: green;
        }
        section div:nth-child(3) {
            width: 100px;
            height: 150px;
            background-color: red;
        }
     
        p { 
            display: flex;
            width: 60%;
            height: 150px;
            background-color: pink;
            margin: 150px auto;  
        }
        p span {
            background-color: skyblue;
            /* 每个span盒子各占一份父盒子的宽（p width60%）所以每个span各分配百分之20% */
            flex: 1;
        }
        p span:nth-child(2) {
            /* 第二个span 指定分配2份父盒子的宽 */
            flex: 2;
            background-color: purple;
        }
        
    </style>
</head>
<body>
     <section>
         <div></div>
         <div></div>
         <div></div>
     </section>
     <p>
         <span>1</span><span>2</span><span>3</span>
     </p>
</body>
</html>